<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2020/4/20
 * Time: 10:01
 */

namespace app\adminapiv3\controller;

//设置
class DefaultSetting extends Base
{
    /**
     * @name 恢复默认设置
     * @Author wx
     * @date 2019/8/16 13:19
     */
    public function defaultSetting()
    {
        global $logContent;
        $logContent = '恢复默认设置';

        $host_id = $this->filterInput('host_id*', 'post');

        $server = new \app\adminapiv3\service\DefaultSetting();
        $server->defaultSetting($host_id);


        $this->jsonOutPut([],true);

        $this->Async('Client', 'Restart');
    }

    /**
     * @name 重启操作系统
     * @Author wx
     * @date 2019/8/16 13:20
     */
    public function restartDevice()
    {
        global $logContent;
        $logContent = '重启操作系统';

        $host_id = $this->filterInput('host_id*', 'post');

        $server = new \app\adminapiv3\service\Base();
        $server->checkOptionHost($host_id);


        $this->jsonOutPut([],true);

        $this->Async('Client', 'Reboot');
    }

    /**
     * @name 重启平台操作系统
     * @author wx
     * @date 2020/6/28 14:38
     */
    public function restartPlatform()
    {
        global $logContent;
        $logContent = '重启平台操作系统';

        //生成文件
        $filePath = 'config/reboot.conf';
        file_put_contents($filePath,'reboot file');
        $this->jsonOutPut();
    }

}